home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Webster's Millennium Amer…Sign Language Dictionary
/
ASL.ISO
/
mac
/
SHARED.cst
/
00006_Script_download tools
< prev
next >
Wrap
Text File
|
2001-09-17
|
11KB
|
330 lines
--∂ï
on addDownLoads
global gWordList,gAddList,gDownLoads,gDLToOtherLangs,gStartUpVol
if the runmode = "author" then
put "addDownLoads"
end if
scanForNewDownLoads
set gDownLoadsNotFound = []
tell window "dData" to put integer(field "TotalDown") into gNumDownLoads
if gNumDownLoads = 0 then exit
tell window "dData" to put the text of cast "downloads" into gDownLoads
if gDownLoads = "none" then exit
set DLTemp = getStringToList(gDownLoads)
sort(DLTemp)
set gDownLoads=getListToString(DLTemp)
delete line (the number of lines of gDownLoads) of gDownLoads
repeat with i = 1 to the number of lines of gDownLoads
add gWordList,line i of gDownLoads
end repeat
if getAt(gWordList,count(gWordList)) = "" then deleteAt(gWordList,count(gWordList))
sort(gWordList)
set gAddList = []
repeat with i = 1 to the number of lines of gDownLoads
add gAddList getPos(gWordList,line i of gDownLoads)
end repeat
updateAlphaLocs
updateListing
end
on scanForNewDownLoads
global gStartUpVol,myAlertWindow
set n = 1
if the machineType = 256 then
if getNthFileNameInFolder(gStartUpVol&"\dwnlds\TEXT", n) = "" then exit
--peteMACK 07.09.01 alertBox "Adding Downloaded signs..."
repeat while getNthFileNameInFolder(gStartUpVol&"\dwnlds\TEXT", n) <> ""
set aFile = getNthFileNameInFolder(gStartUpVol&"\dwnlds\TEXT", n)
if aFile contains ".txt" then addDownLoad aFile
set n=n+1
end repeat
--peteMACK 07.09.01 close myAlertWindow
--peteMACK 07.09.01 forget myAlertWindow
else
if getNthFileNameInFolder(gStartUpVol&":dwnlds:TEXT", n) = "" then exit
--peteMACK 07.09.01 alertBox "Adding Downloaded signs..."
repeat while getNthFileNameInFolder(gStartUpVol&":dwnlds:TEXT", n) <> ""
set aFile = getNthFileNameInFolder(gStartUpVol&":dwnlds:TEXT", n)
if aFile contains ".txt" then addDownLoad aFile
set n=n+1
end repeat
--peteMACK 07.09.01 close myAlertWindow
--peteMACK 07.09.01 forget myAlertWindow
end if
end
on GetString theFile, vAppName, theString
global myFileObject
if objectP(myFileObject) then set myFileObject = 0
set myFileObject = new(xtra "fileIO")
openFile(myFileObject,theFile,1)
set vFileData = readFile(myFileObject)
closeFile(myFileObject)
set myFileObject = 0
if voidP(vFileData) then return the pathname
put the number of lines in vFileData into vNumOfLines
repeat with x = 1 to vNumOfLines
set vLine = line x of vFileData
if vLine contains theString then
set the itemdelimiter = "="
return item 2 of vLine
set the itemdelimiter = ","
exit
end if
end repeat
if voidP(theString) then return vFileData
end
on ReadCDTestFileFail theFile
global myFileObject
if objectP(myFileObject) then set myFileObject = 0
set vFileToRead = theFile
set myFileObject = new(xtra "fileIO")
openFile(myFileObject,vFileToRead,1)
set vFileData = readFile(myFileObject)
set vFlag = status(myFileObject)
closeFile(myFileObject)
set myFileObject = 0
if the runmode = "author" then
put "vFileData" && vFileData
end if
return vFileData
end
on addDownLoad aFile
global gStartUpVol
if the runmode = "author" then
put "addDownLoad" && aFile
end if
----PETEMACK 06.27.01
-- if the machineType = 256 then
-- set openFile = fileio(mNew,"read",gStartUpVol&"\dwnlds\TEXT\"&aFile)
-- else set openFile = fileio(mNew,"read",gStartUpVol&":dwnlds:TEXT:"&aFile)
-- set dictEntry = openFile(mReadFile)
if the machineType = 256 then
set dictEntry = ReadCDTestFileFail (gStartUpVol&"\dwnlds\TEXT\"&aFile)
else
set dictEntry = ReadCDTestFileFail (gStartUpVol&":dwnlds:TEXT:"&aFile)
end if
-- set aFile = "Read Me First"
-- set vFilePath = string(gStartUpVol&":dwnlds:TEXT:"&aFile)
-- GetString vFilePath
-- set dictEntry = the result
set the itemDelimiter to TAB
tell window "dData" to set EntryExists = the number of cast (item 1 of dictEntry)
alertMessage "Adding Downloaded signs..."&return&"- "&item 1 of dictEntry&" -"
if EntryExists = -1 then
tell window "dData" to set newCast = findEmpty(cast 5000)
tell window "dData" to duplicate cast 5000,newCast
--
tell window "dData" to set the name of cast newCast = item 1 of dictEntry
tell window "dData" to put "" into field newCast
repeat with i = 2 to the number of items of dictEntry
tell window "dData" to put item i of dictEntry&"*" after field newCast
end repeat
tell window "dData" to put string(integer(field "totalDown")+1) into field "totalDown"
tell window "dData" to put field "downloads" into gDownLoads
if gDownLoads = "none" then
tell window "dData" to put the name of cast newCast into field "DownLoads"
else tell window "dData" to put return&the name of cast newCast after field "DownLoads"
end if
set the itemDelimiter to ","
----PETEMACK 06.27.01 openFile(mDispose)
end
on fileFound aWord
global gStartUpVol,gDownLoads
tell window "dData" to put field aWord into entryData
set the itemdelimiter to "*"
set fileName = item 5 of entryData
set the itemdelimiter to ","
repeat with i = 1 to the number of lines of gDownLoads
if the machineType = 256 then
if getNthFileNameInFolder(gStartUpVol&"\dwnlds", i) = fileName then
return true
end if
else
if getNthFileNameInFolder(gStartUpVol&":aslFiles:dwnlds", i) = fileName then
return true
end if
end if
end repeat
return false
end
on DownLoadList
--tell window "dData" to put the text of cast "downloads"
end DownLoadList
on updateAlphaLocs
global gAlphaBet,AlphaLocsE,gDownLoads
repeat with i = 1 to the number of lines of gDownLoads
set letter = checkCase(char 1 of line i of gDownLoads)
repeat with j = getPos(gAlphaBet,letter)+1 to 25
set update = integer(getat(AlphaLocsE,getPos(gAlphaBet,letter)+1))+1
setAt(AlphaLocsE,getPos(gAlphaBet,letter)+1,string(update))
set letter = NumtoChar(chartonum(letter)+1)
end repeat
end repeat
end
on updateListing
global scrollListE,gDownLoads,gWordList
repeat with i = 1 to the number of lines of gDownLoads
set insertPos = (getPos(gWordlist,line i of gDownLoads)-1)
put return&line i of gDownLoads after line insertPos of scrollListE
end repeat
end
on checkCase letter
if charToNum(letter) > 96 then return numToChar(charToNum(letter)-(96-64))
else return letter
end checkCase
on addDLToSpanish
global gAddList,gDownLoads,gWordList
global gSpList,gSpSortedList,gSpAddedList
if voidp(gAddList) or gAddList = [] then exit
set the itemdelimiter to "*"
set gSpAddedList = []
repeat with i = 1 to count(gAddList)
if getAt(gAddList,i) = 0 then next repeat
tell window "dData" to set entryData = the text of cast getAt(gWordList,getAt(gAddList,i))
set position = getAt(gAddList,i)
set aWord = item 1 of entryData
if getPos(gSpList,aWord) = 0 then
addAt gSpList, position, aWord
addAt gSpSortedList, position, aWord
add gSpAddedList,aWord
end if
end repeat
updateSpanishAlphaLocs
set the itemDelimiter to ","
end
on addDLToFrench
global gAddList,gDownLoads,gWordList
global gFrList,gFrSortedList,gFrAddedList
if voidp(gAddList) or gAddList = [] then exit
set the itemdelimiter to "*"
set gFrAddedList = []
repeat with i = 1 to count(gAddList)
if getAt(gAddList,i) = 0 then next repeat
tell window "dData" to set entryData = the text of cast getAt(gWordList,getAt(gAddList,i))
set position = getAt(gAddList,i)
set aWord = item 2 of entryData
if getPos(gFrList,aWord) = 0 then
addAt gFrList, position, aWord
addAt gFrSortedList, position, aWord
add gFrAddedList,aWord
end if
end repeat
updateFrenchAlphaLocs
set the itemDelimiter to ","
end
on addDLToGerman
global gAddList,gDownLoads,gWordList
global gGeList,gGeSortedList,gGeAddedList
if voidp(gAddList) or gAddList = [] then exit
set the itemdelimiter to "*"
set gGeAddedList = []
repeat with i = 1 to count(gAddList)
if getAt(gAddList,i) = 0 then next repeat
tell window "dData" to set entryData = the text of cast getAt(gWordList,getAt(gAddList,i))
set position = getAt(gAddList,i)
set aWord = item 3 of entryData
if getPos(gGeList,aWord) = 0 then
addAt gGeList, position, aWord
addAt gGeSortedList, position, aWord
add gGeAddedList,aWord
end if
end repeat
updateGermanAlphaLocs
set the itemDelimiter to ","
end
on addDLToItalian
global gAddList,gDownLoads,gWordList
global gItList,gItSortedList,gItAddedList
if voidp(gAddList) or gAddList = [] then exit
set the itemdelimiter to "*"
set gItAddedList = []
repeat with i = 1 to count(gAddList)
if getAt(gAddList,i) = 0 then next repeat
tell window "dData" to set entryData = the text of cast getAt(gWordList,getAt(gAddList,i))
set position = getAt(gAddList,i)
set aWord = item 4 of entryData
if getPos(gItList,aWord) = 0 then
addAt gItList, position, aWord
addAt gItSortedList, position, aWord
add gItAddedList,aWord
end if
end repeat
updateItalianAlphaLocs
set the itemDelimiter to ","
end
on updateSpanishAlphaLocs
global gAlphaBet,gSpAlpha,gSpAddedList
repeat with i = 1 to count(gSpAddedList)
set letter = checkCase(char 1 of getAt(gSpAddedList,i))
repeat with j = getPos(gAlphaBet,letter)+1 to 25
set update = integer(getat(gSpAlpha,getPos(gAlphaBet,letter)+1))+1
setAt(gSpAlpha,getPos(gAlphaBet,letter)+1,string(update))
set letter = NumtoChar(chartonum(letter)+1)
end repeat
end repeat
end
on updateFrenchAlphaLocs
global gAlphaBet,gFrAlpha,gFrAddedList
repeat with i = 1 to count(gFrAddedList)
set letter = checkCase(char 1 of getAt(gFrAddedList,i))
repeat with j = getPos(gAlphaBet,letter)+1 to 25
set update = integer(getat(gFrAlpha,getPos(gAlphaBet,letter)+1))+1
-- setAt(gFrAlpha,getAt(gAlphaBet,letter),string(update))
setAt(gFrAlpha,getPos(gAlphaBet,letter),string(update))
set letter = NumtoChar(chartonum(letter)+1)
end repeat
end repeat
end
on updateGermanAlphaLocs
global gAlphaBet,gGeAlpha,gGeAddedList
repeat with i = 1 to count(gGeAddedList)
set letter = checkCase(char 1 of getAt(gGeAddedList,i))
repeat with j = getPos(gAlphaBet,letter)+1 to 25
set update = integer(getat(gGeAlpha,getPos(gAlphaBet,letter)+1))+1
setAt(gGeAlpha,getPos(gAlphaBet,letter)+1,string(update))
set letter = NumtoChar(chartonum(letter)+1)
end repeat
end repeat
end
on updateItalianAlphaLocs
global gAlphaBet,gItAlpha,gItAddedList
repeat with i = 1 to count(gItAddedList)
set letter = checkCase(char 1 of getAt(gItAddedList,i))
repeat with j = getPos(gAlphaBet,letter)+1 to 25
set update = integer(getat(gItAlpha,getPos(gAlphaBet,letter)+1))+1
setAt(gItAlpha,getPos(gAlphaBet,letter)+1,string(update))
set letter = NumtoChar(chartonum(letter)+1)
end repeat
end repeat
end